package com.sg.controller.bff;

import com.sg.service.biz.bff.UnstructuredDataService;
import com.sg.dto.biz.bff.req.*;
import com.sg.dto.biz.bff.res.*;
import com.sg.common.ro.OkrResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author ：
 * @version 1.0
 * @date ：
 */
@Api(value = "UnstructuredData", tags = {"UnstructuredData"})
@RestController
// @RequestMapping("/oms/unstructuredData/")
public class UnstructuredDataController {


    @Autowired
    UnstructuredDataService unstructuredDataService;

    /**
     * B3-查询业务应用文档关系列表(公共)
     * gen by moon at 9/24/2022, 4:28:38 AM
     */
    @PostMapping("/oms/unstructuredData/queryBusAppDocRelaListCom")
    @ApiOperation(value = "B3-查询业务应用文档关系列表(公共)", response = OkrResult.class)
    public OkrResult<BffQueryBusAppDocRelaListComRespDto> queryBusAppDocRelaListCom(@RequestBody(required = false) @Validated BffQueryBusAppDocRelaListComReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryBusAppDocRelaListCom(reqDTO));
    }

    /**
     * B3-删除业务应用文档关系(公共)
     * gen by moon at 11/15/2022, 3:48:07 PM
     */
    @PostMapping("/oms/unstructuredData/deleteBusAppDocRelaCom")
    @ApiOperation(value = "B3-删除业务应用文档关系(公共)", response = OkrResult.class)
    public OkrResult<BffDeleteBusAppDocRelaComRespDto> deleteBusAppDocRelaCom(@RequestBody(required = false) @Validated BffDeleteBusAppDocRelaComReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.deleteBusAppDocRelaCom(reqDTO));
    }

    /**
     * B3执行删除业务应用文档附件
     * gen by moon at 9/26/2023, 1:35:16 PM
     */
    @PostMapping("/oms/unstructuredData/implementDelBusAppDocRela")
    @ApiOperation(value = "B3执行删除业务应用文档附件", response = OkrResult.class)
    public OkrResult<BffImplementDelBusAppDocRelaRespDto> implementDelBusAppDocRela(@RequestBody(required = false) @Validated BffImplementDelBusAppDocRelaReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementDelBusAppDocRela(reqDTO));
    }

    /**
     * B2查询文档关系实例列表
     * gen by moon at 3/27/2024, 1:32:39 AM
     */
    @PostMapping("/oms/unstructuredData/queryUnstructuredRelationshipInstanceList")
    @ApiOperation(value = "B2查询文档关系实例列表", response = OkrResult.class)
    public OkrResult<BffQueryUnstructuredRelationshipInstanceListRespDto> queryUnstructuredRelationshipInstanceList(@RequestBody(required = false) @Validated BffQueryUnstructuredRelationshipInstanceListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryUnstructuredRelationshipInstanceList(reqDTO));
    }

    // TODO: 2024/5/10 改造,手改代码，勿动

    /**
     * B2执行上传文档
     * gen by moon at 3/27/2024, 1:32:47 AM
     */
    @PostMapping("/oms/unstructuredData/implementUploadFile")
    @ApiOperation(value = "B2执行上传文档", response = OkrResult.class)
    public OkrResult<BffImplementUploadFileRespDto> implementUploadFile(@RequestParam(value = "hashCode", required = false) String hashCode,
                                                                        @RequestParam(value = "uploadCroppedImage", required = false) String uploadCroppedImage,
                                                                        @RequestParam("platformOrTenantDoc") String platformOrTenantDoc,
                                                                        @RequestParam(value = "uploadImageSpecifications", required = false) String uploadImageSpecifications,
                                                                        @RequestParam(value = "unstructuredDataFolderId", required = false) String unstructuredDataFolderId,
                                                                        @RequestParam(value = "folderName", required = false) String folderName,
                                                                        @RequestParam(value = "isPrivateNetDisk", required = false) String isPrivateNetDisk,
                                                                        @RequestParam(value = "docUseType", required = false) String docUseType,
                                                                        @RequestParam(value = "isUserUpload", required = false) String isUserUpload,
                                                                        @RequestParam(value = "resourceCopyRightType", required = false) String resourceCopyRightType,
                                                                        @RequestParam(value = "resourceCopyRightHolderId", required = false) String resourceCopyRightHolderId,
                                                                        @RequestParam(value = "originalRoleMemberId", required = false) String originalRoleMemberId,
                                                                        @RequestParam(value = "themeContentTypeCode", required = false) String themeContentTypeCode,
                                                                        @RequestParam(value = "themeContentId", required = false) String themeContentId,
                                                                        @RequestParam(value = "spaceId", required = false) String spaceId,
                                                                        MultipartFile uploadFile) {
        // TODO: 2024/5/10 手写代码 
        BffImplementUploadFileReqDto reqDTO = new BffImplementUploadFileReqDto();
        reqDTO.setUploadCroppedImage(uploadCroppedImage);
        reqDTO.setPlatformOrTenantDoc(platformOrTenantDoc);
        reqDTO.setUploadImageSpecifications(uploadImageSpecifications);
        reqDTO.setUnstructuredDataFolderId(unstructuredDataFolderId);
        reqDTO.setFolderName(folderName);
        reqDTO.setIsPrivateNetDisk(isPrivateNetDisk);
        reqDTO.setDocUseType(docUseType);
        reqDTO.setIsUserUpload(isUserUpload);
        reqDTO.setOriginalRoleMemberId(originalRoleMemberId);
        reqDTO.setThemeContentTypeCode(themeContentTypeCode);
        reqDTO.setThemeContentId(themeContentId);
        reqDTO.setSpaceId(spaceId);
        reqDTO.setUploadFile(uploadFile);
        reqDTO.setResourceCopyRightType(resourceCopyRightType);
        reqDTO.setResourceCopyRightHolderId(resourceCopyRightHolderId);
        reqDTO.setHashCode(hashCode);
        return OkrResult.success(unstructuredDataService.implementUploadFile(reqDTO));
    }

    /**
     * B3执行分离新增或删除文档列表(管理)
     * gen by moon at 3/27/2024, 10:54:46 PM
     */
    @PostMapping("/oms/mgt/unstructuredData/implementSeparateAddOrDeleteDocList")
    @ApiOperation(value = "B3执行分离新增或删除文档列表(管理)", response = OkrResult.class)
    public OkrResult<BffImplementSeparateAddOrDeleteDocListRespDto> implementSeparateAddOrDeleteDocList(@RequestBody(required = false) @Validated BffImplementSeparateAddOrDeleteDocListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementSeparateAddOrDeleteDocList(reqDTO));
    }

    /**
     * B2查询我的网盘最新文档列表
     * gen by moon at 3/27/2024, 10:54:55 PM
     */
    @PostMapping("/oms/unstructuredData/queryMyNetDiskLatestDocList")
    @ApiOperation(value = "B2查询我的网盘最新文档列表", response = OkrResult.class)
    public OkrResult<BffQueryMyNetDiskLatestDocListRespDto> queryMyNetDiskLatestDocList(@RequestBody(required = false) @Validated BffQueryMyNetDiskLatestDocListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryMyNetDiskLatestDocList(reqDTO));
    }

    /**
     * B2新增文件夹
     * gen by moon at 3/27/2024, 10:55:04 PM
     */
    @PostMapping("/oms/unstructuredData/addDataFolder")
    @ApiOperation(value = "B2新增文件夹", response = OkrResult.class)
    public OkrResult<BffAddDataFolderRespDto> addDataFolder(@RequestBody(required = false) @Validated BffAddDataFolderReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.addDataFolder(reqDTO));
    }

    /**
     * B2修改文件夹
     * gen by moon at 3/27/2024, 10:55:28 PM
     */
    @PostMapping("/oms/unstructuredData/updateDataFolder")
    @ApiOperation(value = "B2修改文件夹", response = OkrResult.class)
    public OkrResult<BffUpdateDataFolderRespDto> updateDataFolder(@RequestBody(required = false) @Validated BffUpdateDataFolderReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.updateDataFolder(reqDTO));
    }

    /**
     * B2查询文件夹列表
     * gen by moon at 3/27/2024, 10:56:09 PM
     */
    @PostMapping("/oms/unstructuredData/queryDataFolderList")
    @ApiOperation(value = "B2查询文件夹列表", response = OkrResult.class)
    public OkrResult<BffQueryDataFolderListRespDto> queryDataFolderList(@RequestBody(required = false) @Validated BffQueryDataFolderListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryDataFolderList(reqDTO));
    }

    /**
     * B2删除单个文档关系或文档
     * gen by moon at 4/5/2024, 9:23:18 PM
     */
    @PostMapping("/oms/unstructuredData/deleteSingleDocRelOrDoc")
    @ApiOperation(value = "B2删除单个文档关系或文档", response = OkrResult.class)
    public OkrResult<BffDeleteSingleDocRelOrDocRespDto> deleteSingleDocRelOrDoc(@RequestBody(required = false) @Validated BffDeleteSingleDocRelOrDocReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.deleteSingleDocRelOrDoc(reqDTO));
    }

    /**
     * B3查询目标下成果网盘我的下属列表
     * gen by moon at 7/22/2024, 6:34:34 PM
     */
    @PostMapping("/oms/unstructuredData/queryTargetNetDiskMySubordinateList")
    @ApiOperation(value = "B3查询目标下成果网盘我的下属列表", response = OkrResult.class)
    public OkrResult<BffQueryTargetNetDiskMySubordinateListRespDto> queryTargetNetDiskMySubordinateList(@RequestBody(required = false) @Validated BffQueryTargetNetDiskMySubordinateListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryTargetNetDiskMySubordinateList(reqDTO));
    }

    /**
     * B3查询目标下成果网盘高层目标周期导航列表
     * gen by moon at 7/22/2024, 6:34:37 PM
     */
    @PostMapping("/oms/unstructuredData/queryTargetNetDiskTopPlanTargetCycleMenuList")
    @ApiOperation(value = "B3查询目标下成果网盘高层目标周期导航列表", response = OkrResult.class)
    public OkrResult<BffQueryTargetNetDiskTopPlanTargetCycleMenuListRespDto> queryTargetNetDiskTopPlanTargetCycleMenuList(@RequestBody(required = false) @Validated BffQueryTargetNetDiskTopPlanTargetCycleMenuListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryTargetNetDiskTopPlanTargetCycleMenuList(reqDTO));
    }

    /**
     * B3查询目标下成果网盘中基层目标周期导航列表
     * gen by moon at 7/22/2024, 6:34:39 PM
     */
    @PostMapping("/oms/unstructuredData/queryTargetNetDiskMidOrGrassrootsPlanTargetCycleMenuList")
    @ApiOperation(value = "B3查询目标下成果网盘中基层目标周期导航列表", response = OkrResult.class)
    public OkrResult<BffQueryTargetNetDiskMidOrGrassrootsPlanTargetCycleMenuListRespDto> queryTargetNetDiskMidOrGrassrootsPlanTargetCycleMenuList(@RequestBody(required = false) @Validated BffQueryTargetNetDiskMidOrGrassrootsPlanTargetCycleMenuListReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.queryTargetNetDiskMidOrGrassrootsPlanTargetCycleMenuList(reqDTO));
    }

    /**
     * B3执行按目标周期查询目标下成果网盘内容列表
     * gen by moon at 7/22/2024, 6:34:42 PM
     */
    @PostMapping("/oms/unstructuredData/implementTargetNetDiskContent")
    @ApiOperation(value = "B3执行按目标周期查询目标下成果网盘内容列表", response = OkrResult.class)
    public OkrResult<BffImplementTargetNetDiskContentRespDto> implementTargetNetDiskContent(@RequestBody(required = false) @Validated BffImplementTargetNetDiskContentReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementTargetNetDiskContent(reqDTO));
    }

    /**
     * B3执行按身份人员查目标下网盘内容列表
     * gen by moon at 7/22/2024, 6:34:45 PM
     */
    @PostMapping("/oms/unstructuredData/implementTargetNetDiskContentByOriRoleMem")
    @ApiOperation(value = "B3执行按身份人员查目标下网盘内容列表", response = OkrResult.class)
    public OkrResult<BffImplementTargetNetDiskContentByOriRoleMemRespDto> implementTargetNetDiskContentByOriRoleMem(@RequestBody(required = false) @Validated BffImplementTargetNetDiskContentByOriRoleMemReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementTargetNetDiskContentByOriRoleMem(reqDTO));
    }

    /**
     * B3执行按身份人员查目标下网盘文档列表
     * gen by moon at 7/22/2024, 6:34:48 PM
     */
    @PostMapping("/oms/unstructuredData/implementTargetNetDiskDocByOriRoleMem")
    @ApiOperation(value = "B3执行按身份人员查目标下网盘文档列表", response = OkrResult.class)
    public OkrResult<BffImplementTargetNetDiskDocByOriRoleMemRespDto> implementTargetNetDiskDocByOriRoleMem(@RequestBody(required = false) @Validated BffImplementTargetNetDiskDocByOriRoleMemReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementTargetNetDiskDocByOriRoleMem(reqDTO));
    }

    /**
     * B3执行按部门查目标下网盘内容列表
     * gen by moon at 7/22/2024, 6:34:51 PM
     */
    @PostMapping("/oms/unstructuredData/implementTargetNetDiskContentByDeptId")
    @ApiOperation(value = "B3执行按部门查目标下网盘内容列表", response = OkrResult.class)
    public OkrResult<BffImplementTargetNetDiskContentByDeptIdRespDto> implementTargetNetDiskContentByDeptId(@RequestBody(required = false) @Validated BffImplementTargetNetDiskContentByDeptIdReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementTargetNetDiskContentByDeptId(reqDTO));
    }

    /**
     * B3执行按部门查目标下网盘文档列表
     * gen by moon at 7/22/2024, 6:34:55 PM
     */
    @PostMapping("/oms/unstructuredData/implementTargetNetDiskDocByDeptId")
    @ApiOperation(value = "B3执行按部门查目标下网盘文档列表", response = OkrResult.class)
    public OkrResult<BffImplementTargetNetDiskDocByDeptIdRespDto> implementTargetNetDiskDocByDeptId(@RequestBody(required = false) @Validated BffImplementTargetNetDiskDocByDeptIdReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementTargetNetDiskDocByDeptId(reqDTO));
    }

    /**
     * B3执行按工作周期查目标下网盘文档列表
     * gen by moon at 7/22/2024, 10:22:12 PM
     */
    @PostMapping("/oms/unstructuredData/implementTargetNetDiskDocByTargetCycleId")
    @ApiOperation(value = "B3执行按工作周期查目标下网盘文档列表", response = OkrResult.class)
    public OkrResult<BffImplementTargetNetDiskDocByTargetCycleIdRespDto> implementTargetNetDiskDocByTargetCycleId(@RequestBody(required = false) @Validated BffImplementTargetNetDiskDocByTargetCycleIdReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementTargetNetDiskDocByTargetCycleId(reqDTO));
    }

    /**
     * B3执行按成果类型查成果库下网盘文档列表
     * gen by moon at 7/22/2024, 10:22:23 PM
     */
    @PostMapping("/oms/unstructuredData/implementAchievementNetDiskDocByAchTypeId")
    @ApiOperation(value = "B3执行按成果类型查成果库下网盘文档列表", response = OkrResult.class)
    public OkrResult<BffImplementAchievementNetDiskDocByAchTypeIdRespDto> implementAchievementNetDiskDocByAchTypeId(@RequestBody(required = false) @Validated BffImplementAchievementNetDiskDocByAchTypeIdReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.implementAchievementNetDiskDocByAchTypeId(reqDTO));
    }

    /**
     * B2删除文件夹
     * gen by moon at 8/12/2024, 8:35:11 PM
     */
    @PostMapping("/oms/unstructuredData/deleteDataFolder")
    @ApiOperation(value = "B2删除文件夹", response = OkrResult.class)
    public OkrResult<BffDeleteDataFolderRespDto> deleteDataFolder(@RequestBody(required = false) @Validated BffDeleteDataFolderReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.deleteDataFolder(reqDTO));
    }

    /**
     * B3修改文档关系中文档别名
     * gen by moon at 8/25/2024, 1:29:14 PM
     */
    @PostMapping("/oms/unstructuredData/updateUnstructuredRelationship")
    @ApiOperation(value = "B3修改文档关系中文档别名", response = OkrResult.class)
    public OkrResult<BffUpdateUnstructuredRelationshipRespDto> updateUnstructuredRelationship(@RequestBody(required = false) @Validated BffUpdateUnstructuredRelationshipReqDto reqDTO) {
        return OkrResult.success(unstructuredDataService.updateUnstructuredRelationship(reqDTO));
    }
}
